/**
 * 
 */
package com.monte.export.csv;

import java.io.IOException;
import java.io.OutputStream;

import com.monte.export.Configure;
import com.monte.export.ExportDataSource;
import com.monte.export.txt.TxtDataExportor;

/**
 * @author fengmengyue
 *
 */
public class CsvDataExportor<T> extends TxtDataExportor<T> {
	private static final String split = ",";
	private boolean isUtf8 = false;
	public CsvDataExportor(ExportDataSource<T> dataSource,
			OutputStream outputStream, Configure configure,boolean isUtf8) {
		super(dataSource, outputStream, configure, split);
		this.isUtf8 = isUtf8;
	}

	@Override
	protected void startExport() throws IOException {
		if(isUtf8){
			outputStream.write(new byte[] { (byte) 0xEF, (byte) 0xBB, (byte) 0xBF });//
		}
		super.startExport();
	}
}
